const getters = {
  sidebar: (state) => state.app.sidebar,
  size: (state) => state.app.size,
  device: (state) => state.app.device,
  visitedViews: (state) => state.tagsView.visitedViews,
  cachedViews: (state) => state.tagsView.cachedViews,
  token: (state) => state.user.token,
  userName: (state) => {
    if (!state.user.userName) {
      state.user.userName = localStorage.getItem('userName')
    }
    return state.user.userName
  },
  userId: (state) => {
    if (!state.user.userId) {
      state.user.userId = localStorage.getItem('userId')
    }
    return state.user.userId
  },
  indexDict: (state) => state.index_dict,
  globalContrastOpenView: (state) => state.contrast.globalContrastOpen_view,
  contrastList: (state) => state.contrast.contrastList,
  createCombId: (state) => state.contrast.createComb_id,
  createComb: (state) => {
    if (!state.contrast.createComb.length) {
      state.contrast.createComb = localStorage.getItem('createComb')
        ? JSON.parse(localStorage.getItem('createComb'))
        : []
    }
    return state.contrast.createComb
  },
  avatar: (state) => state.user.avatar,
  name: (state) => state.user.name,
  introduction: (state) => state.user.introduction,
  roles: (state) => state.user.roles,
  permission_routes: (state) => state.permission.routes,
  errorLogs: (state) => state.errorLog.logs,
}
export default getters
